using System;
using System.Diagnostics;
using System.Windows.Forms;
using SampleApplication;

namespace BIM3DXMLExport
{
   /// <summary>
   /// Manager class for dialogs in the project.
   /// </summary>
   public class XMLDialogManager
   {
      /// <summary>
      /// Pop up a standard SaveAs dialog.
      /// </summary>
      /// <returns>The filename return by SaveAs dialog.</returns>
      public static string SaveDialog()
      {
         // save file dialog options
         using (SaveFileDialog saveDialog = new SaveFileDialog())
         {
            saveDialog.OverwritePrompt = true;
            saveDialog.AddExtension = true;
            saveDialog.DefaultExt = XMLExportResource.SAVE_DIALOG_DEFAULT_FILE_EXTEND;
            saveDialog.Filter = XMLExportResource.SAVE_DIALOG_FILE_FILTER;

            if (System.Windows.Forms.DialogResult.OK != saveDialog.ShowDialog())
            {
               return String.Empty;
            }
            return saveDialog.FileName;
         }
      }

      /// <summary>
      /// Used to show error message when debug.
      /// </summary>
      /// <param name="exception">The exception message.</param>
      [Conditional("DEBUG")]
      public static void ShowDebug(string exception)
      {
          MessageBox.Show(exception, XMLExportResource.MESSAGE_BOX_TITLE,
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
      }
   }
}
